<?php
/**
 * Created by cmb_weixin.master.
 * File: ProductOrderReserve.php
 * User: xuewl
 * Date: 2017/12/28
 * Time: 23:32
 */

namespace app\product\behavior;

class ProductOrderReserve
{
    public function run(&$params) {}

    /**
     * 抢单时间到期
     */
    public function FlowLimitReviewAfter() {
        $product_order_flow_limit = config('product.product_order_reserve_interval');
        $end_time = time() - $product_order_flow_limit * 60;
        $maps = [
            'status' => 0,
            'stage' => 0,
            'customer_id' => 0,
            'reserve_time' => ['BETWEEN TIME', [1, $end_time]]
        ];
        $sns = \think\Db::name('product_order')
            ->where($maps)
            ->limit(100)
            ->column('sn');

        $model = model('product/product_order_reserve', 'service');
        foreach ($sns as $sn) {
            $model->review($sn, 0);
        }
    }

}